<?php

/*
 * Action -5$
 *
 * +1 buy
 * +1 $
 * While this is in play, when you buy a card take a Coin token
 * 
 */

class MerchantGuild extends Card implements iAction, iKingdom, iGuilds, iCoinTokensRequired, iReactingCard {

     private $reactConditions;
     
    public function __construct() {
        parent::__construct("Merchant Guild", 5);
        $this->undoPlay = false;
        $this->undoBuy = false;
        
        $this->reactConditions = new ReactionConditions();
        $this->reactConditions->action = array(Buy);
        $this->reactConditions->actor = array(Yourself);
        $this->reactConditions->cardLocation = array(PlayArea);
        $this->reactConditions->limit = ForEachCard;
        $this->reactConditions->isMandatory = true;
        
    }

    public function getDescription() {
        return array(
            "+1 buy",
            "+1$",
            "While this is in play, when you buy a card take a coin token");
    }
    
    public function getConditions() {
        return $this->reactConditions;
    }

    public function isReactRelevant(Game $game, $card, $name) {
        return true;
    }

    public function react(Game $game, $card, $name) {
        $game->addCoinTokens(1, $name);
        ScreenDisplay::addScreenMessage($game, true, "activate ".  nicePrint($this), "activates ".  nicePrint($this), $name);
        ScreenDisplay::addScreenMessage($game, false, " and get 1 coin token ", " and gets 1 coin token ", $name);
    }

    public function play(Game $game, $isRealCard) {
        $game->addBuys(1);
        $game->addMoney(new Price(1));
        
         ScreenDisplay::addScreenMessage($game, true, "get +1 buy and +1$", "get +1 buy and +1$");
        $game->cardActionFinished();
        return true;
    }

}

?>